package com.baturu.vin.ford.dal.dao;

import com.baturu.vin.ford.dal.entity.FordPartsMappingEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.List;
import java.util.Set;

public interface FordPartsMappingDAO {

    /**
     * 通过主名查询主名映射信息
     *
     * @param partsNames 主名
     * @return 主名映射数据
     */
    @Select({"<script>",
            "SELECT partsCode, btrPartsName FROM ford_parts_mapping ",
            "WHERE btrPartsName IN ",
            "<foreach item='item' index='index' collection='partsNames' open='(' separator=',' close=') '>",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<FordPartsMappingEntity> queryByPartsName(@Param("partsNames") Set<String> partsNames);

    /**
     * 通过主名查询主名映射信息
     *
     * @param partsNames 主名
     * @return 主名映射数据
     */
    @Select({"<script>",
            "SELECT partsCode, btrPartsName FROM ford_parts_mapping ",
            "WHERE partsCode IN ",
            "<foreach item='item' index='index' collection='partsCodes' open='(' separator=',' close=') '>",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<FordPartsMappingEntity> queryByPartsCode(@Param("partsCodes") Collection<String> partsNames);
}